-
-
Notifications
You must be signed in to change notification settings - Fork 398
Query the backend to get the fqbn when a core is not installed #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later on we could remove the builder api endpoint being directly in the code and put it somewhere else as a variable. But OK for now!
retVal := []*rpc.BoardListItem{} | ||
req, _ := http.NewRequest("GET", url, nil) | ||
req.Header = globals.HTTPClientHeader | ||
req.Header.Set("Content-Type", "application/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put the user-agent header?
An example could be this one https://github.com/arduino/Arduino/blob/324a9bcbbbe540d133604767b5c4d30c5f62c753/arduino-core/src/cc/arduino/utils/network/HttpConnectionManager.java#L59
Example
final String defaultUserAgent = String.format(
"ArduinoIDE/%s (%s; %s; %s; %s) Java/%s (%s)",
BaseNoGui.VERSION_NAME,
System.getProperty("os.name"),
System.getProperty("os.version"),
System.getProperty("os.arch"),
System.getProperty("user.language"),
System.getProperty("java.version"),
System.getProperty("java.vendor")
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user agent is already there, see how globals.HTTPClientHeader
is initialized
Co-Authored-By: Maurizio Branca <[email protected]>
This PR makes the command
arduino-cli board list
properly work even when a core for the connected board is not installed. It works by querying the Arduino Cloud backend passing VID and PID, hence the CLI must be able to access the Internet for this to work.